

#include <ansidecl.h>
#include <string.h>
#include <memcopy.h>


int uart_write(int val);
void printHex(int val);
void print(const void *buf);

int strncmp(const char *cs, const char *ct, size_t count)
{
	unsigned char c1, c2;

	while (count) {
		c1 = *cs++;
		c2 = *ct++;
		if (c1 != c2)
			return c1 < c2 ? -1 : 1;
		if (!c1)
			break;
		count--;
	}
	return 0;
}


char *strchr(const char *s, int c)
{
	while (*s != (char)c){
		if (*s++ == '\0'){
			return 0;
		}
	}
	return (char *)s;
}


size_t strlen(const char *s)
{
	const char *sc = s;

	while (*sc != '\0')
		sc++;
	return sc - s;
}


void *memchr(const void *s, int c, size_t count)
{
	const unsigned char *p = s;

	while (count--)
		if ((unsigned char)c == *p++)
			return (void *)(p - 1);
	return NULL;
}

